<template>
	<view class="content">
		<view class="title">提币</view>
		<view class="curreny">
			<view class="curreny-item">币种</view>
			<view class="curreny-item">USDT</view>
		</view>
		<view class="reacharge-body white">
			<view>
				提币网络
			</view>
			<view>
				<view class="rechargechannel">TRC20</view>
			</view>
			<view class="money">
				<view>提币金额</view>
				<input class="input" type="text" v-model="money" placeholder="提币金额" placeholder-class="placeholder" />
			</view>
		</view>
		<view class="money">
			<view>提币地址</view>
			<input class="input" type="text" v-model="currency_url" placeholder="提币地址" placeholder-class="placeholder" />
		</view>
		<button class="add-btn" @click="confirm">提交</button>
	</view>
</template>

<script>
	// import imgUpload from '@/components/img-upload/img-upload.vue'
	 import {
		mapState
	} from 'vuex';
	let startY = 0,
		moveY = 0,
		pageAtTop = true;
	export default {
		components: {

		},
		data() {
			return {
				coverTransform: 'translateY(0px)',
				coverTransition: '0s',
				moving: false,
				user: {
					balance: 0
				},
				money: 0.00,
				currency_url:"",
			}
		},
		onLoad() {
			uni.hideShareMenu()
		},
		onShow() {
			this.getUser()
		},

		computed: {},
		methods: {
			upload() {
				uni.chooseImage({
					success: (chooseImageRes) => {
						const tempFilePaths = chooseImageRes.tempFilePaths;
						uni.uploadFile({
							url: 'https://sjshop.310xz.com/api/upload/uploadImage', //仅为示例，非真实的接口地址
							filePath: tempFilePaths[0],
							name: 'file',
							method:"post",
							success: (uploadFileRes) => {
								console.log(uploadFileRes.data);
							}
						});
					}
				});
			},
			async getUser() {
				var _this = this
				this.$http.sendRequest({
					url: "api/member/getInfo",
					method: "GET",
					success: function(res) {
						_this.user = res.data.data
						_this.money_url = res.data.data.money_url
					}
				})
			},

			rechargeList() {
				uni.navigateTo({
					url: "/pages/user/recharge_list"
				})
			},
			async confirm() {
				let data = [];
				if (this.money == 0) {
					this.$api.msg('请输入提币金额');
					return;
				}
				if (this.currency_url == 0) {
					this.$api.msg('请输入提币地址');
					return;
				}
				var _this = this
				this.$http.sendRequest({
					url: "api/member_wallet/apply",
					data: {
						currency_url: _this.currency_url,
						money: _this.money
					},
					method: "POST",
					success: function(res) {
						if (res.data.code == 0) {
							_this.$api.msg(res.data.message);
							setTimeout(function() {
								uni.navigateTo({
									url: './wallet'
								})
							}, 2000)
						} else {
							_this.$api.msg(res.data.message);
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: rgb(244, 243, 243);
	}

	.content {
		padding-top: 30rpx;
		padding-left: 30rpx;
		padding-right: 30rpx;
		font-size: 32rpx;
	}

	.white {
		background-color: #FFFFFF;
	}

	.title {
		font-weight: 450;
		font-size: 48rpx;
	}

	.curreny {
		display: flex;
		background-color: #FFFFFF;
		height: 90rpx;
		line-height: 90rpx;
		padding-left: 30rpx;
		padding-right: 30rpx;
		border-radius: 20rpx;
		justify-content: space-between;
		margin-top: 20rpx;
		margin-bottom: 20rpx;
	}

	.address-image {
		width: 400rpx;
		height: 400rpx;
		margin: 0px auto;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.reacharge-body {
		padding-left: 30rpx;
		padding-right: 30rpx;
		padding-top: 30rpx;
		border-radius: 20rpx;
		padding-bottom: 30rpx;

		.rechargechannel {
			border: 1px solid #EBEBEB;
			padding: 30rpx 24rpx;
			height: 80rpx;
			margin: 30rpx auto;
			line-height: 30rpx;
			border-radius: 15rpx;
		}

		.recharge-address {
			display: flex;
			justify-content: space-between;
			align-items: center;

			.wallet-address {
				//width: 200rpx;
				word-break: break-all;
				flex: 1;
				margin-right: 20rpx;
			}

			.copy {
				background-color: rgb(58, 101, 234);
				color: #FFFFFF;
				font-size: 24rpx;
				padding: 15rpx;
				border-radius: 15rpx;
			}
		}
	}

	.money {
		background-color: #FFFFFF;
		border-radius: 20rpx;
		padding: 20rpx;
		margin-top: 15rpx;

		input {
			border: 1px solid #EBEBEB;
			padding: 20rpx 24rpx;
			height: 80rpx;
			margin: 30rpx auto;
			border-radius: 15rpx;
		}
	}

	.add-btn {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 690upx;
		height: 80upx;
		margin: 60upx auto;
		font-size: $font-lg;
		color: #fff;
		background-color: $base-color;
		border-radius: 10upx;
		box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
	}
</style>
